/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhnb
 * Date: 2011-8-18 上午10:21:28
 */
package com.ccx.service;

import java.io.Serializable;

import Ice.Application;

public class ParamTestServer extends Application implements Serializable {

    private static final long serialVersionUID = 4088687675889575556L;

    @Override
    public int run(String[] args) {

        if (args.length > 0) {
            System.err.println(appName() + ": too many arguments");
            return 1;
        }

//        // * 添加自定义类
//        Ice.ObjectFactory factory = new ParamTestFactory();
//        communicator().addObjectFactory(factory, "::dto::ADTO");
        
        Ice.Properties properties = communicator().getProperties();
        Ice.ObjectAdapter adapter = communicator()
                .createObjectAdapterWithEndpoints(appName(),
                        properties.getProperty("MyAppServer.Endpoints"));
        adapter
                .add(
                        new ParamTestI(),
                        communicator()
                                .stringToIdentity(
                                        properties
                        .getProperty("MyApp.uuId")));
        
        adapter.activate();
        
        System.out.println(appName() + " started !");

        communicator().waitForShutdown();
        
        return 0;
    }
    
    public static void main(String[] args) {
        ParamTestServer paramTestServer = new ParamTestServer();
        int status = paramTestServer.main("ParamTestServer", args, "com/ccx/service/common-server.config");
        System.exit(status);
    }

}
